#ifndef STUDYTABLEMODEL_H
#define STUDYTABLEMODEL_H

#include <QSqlRelationalTableModel>
#include <QDateTime>

class StudyTableModel : public QSqlRelationalTableModel
{
    Q_OBJECT
public:
    enum ColumnType {
        Id,
        StudyIUid,
        PatId,
        PatName,
        PatSex,
        PatBirth,
        PatAge,
        PatAdid,
        PatAlert,
        AccNum,
        StudyId,
        StudyTime,
        Modality,
        BodyPart,
        SubmitTime,
        InstiId_FK,
        TaskPhy_FK,
        StateId_FK,
        StudyDesc,

        ColumnCnt,
    };

    explicit StudyTableModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase());

    void setFromTime(const QDateTime &from) { fromTime = from; }
    void setToTime(const QDateTime &to) { toTime = to; }
    void setPatientId(const QString &patientId) { patiId = patientId; }
    void setPatientName(const QString &patientName) { patiName = patientName; }
    void setAccNum(const QString &accNumber) { accNum = accNumber; }
    void setModality(const QString &modality) { moda = modality; }

    void applyFilter();

signals:

public slots:

private:
    QDateTime fromTime;
    QDateTime toTime;
    QString patiId;
    QString patiName;
    QString accNum;
    QString moda;
};

#endif // STUDYTABLEMODEL_H
